// Package sys
// @Link  https://github.com/bufanyun/hotgo
// @Copyright  Copyright (c) 2025 HotGo CLI
// @Author  Ms <133814250@qq.com>
// @License  https://github.com/bufanyun/hotgo/blob/master/LICENSE
// @AutoGenerate Version 2.15.11
package sys

import (
	"context"
	"hotgo/api/admin/auctionhome"
	"hotgo/internal/model/input/sysin"
	"hotgo/internal/service"
)

var (
	AuctionHome = cAuctionHome{}
)

type cAuctionHome struct{}

// List 查看主页显示时间列表
func (c *cAuctionHome) List(ctx context.Context, req *auctionhome.ListReq) (res *auctionhome.ListRes, err error) {
	list, totalCount, err := service.SysAuctionHome().List(ctx, &req.AuctionHomeListInp)
	if err != nil {
		return
	}

	if list == nil {
		list = []*sysin.AuctionHomeListModel{}
	}

	res = new(auctionhome.ListRes)
	res.List = list
	res.PageRes.Pack(req, totalCount)
	return
}

// Export 导出主页显示时间列表
func (c *cAuctionHome) Export(ctx context.Context, req *auctionhome.ExportReq) (res *auctionhome.ExportRes, err error) {
	err = service.SysAuctionHome().Export(ctx, &req.AuctionHomeListInp)
	return
}

// Edit 更新主页显示时间
func (c *cAuctionHome) Edit(ctx context.Context, req *auctionhome.EditReq) (res *auctionhome.EditRes, err error) {
	err = service.SysAuctionHome().Edit(ctx, &req.AuctionHomeEditInp)
	return
}

// View 获取指定主页显示时间信息
func (c *cAuctionHome) View(ctx context.Context, req *auctionhome.ViewReq) (res *auctionhome.ViewRes, err error) {
	data, err := service.SysAuctionHome().View(ctx, &req.AuctionHomeViewInp)
	if err != nil {
		return
	}

	res = new(auctionhome.ViewRes)
	res.AuctionHomeViewModel = data
	return
}

// Delete 删除主页显示时间
func (c *cAuctionHome) Delete(ctx context.Context, req *auctionhome.DeleteReq) (res *auctionhome.DeleteRes, err error) {
	err = service.SysAuctionHome().Delete(ctx, &req.AuctionHomeDeleteInp)
	return
}